package com.yh.correct.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.yh.correct.model.Help;
import com.yh.correct.model.Page;
import com.yh.correct.model.ResultData;
import com.yh.correct.service.IHelpService;

/**
 * 帮困解难登记控制层
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/help")
public class HelpController {
	
	@Autowired
	private IHelpService helpService;
		
	/**
	 * 跳转到帮困解难页面
	 * @return
	 */
	@RequestMapping("/show")
	public ModelAndView toShow(){
		return new ModelAndView("education/help");
	}

	/**
	 * 动态模糊查询帮困解难记录列表
	 * @return
	 */
	@RequestMapping("/getLike")
	public ResultData getLike(String dept,String cname,String pname,Integer pageNum,Integer pageSize){
		Map<String,Object> condition =new HashMap<String,Object>();
		condition.put("dept", dept);
		condition.put("pname", pname);
		condition.put("cname", cname);
		condition.put("pageNum", pageNum);
		condition.put("pageSize", pageSize);
		Page page=helpService.queryLikeHelp(condition);
		ResultData rd=new ResultData();
		List<Page> list=new ArrayList<Page>();
		list.add(page);
		rd.setData(list);
		return rd;
	}
}
